﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="sms_comments.aspx.vb" Inherits="webfinancegdrassign4.sms_comments" %>


<%--Smart Money $aver Project for University of Herts--%>
<%--Date: 01 December 2013--%>
<%--Version 1--%>
<%--Project Brief Description - This is a Smart Money Saver asp.net product using VB.net. It is intended to be used by Smart Money Savers who want to make and save money and earn and save a certain amount to benefit--%>
<%--Program Brief Description - This is the main Site.Master file. All change appear on all pages. This is a standard program from a default build from setting up the project in Visual Studio --%>
<%--Changes - Added an image for the Smart Investor program / website --%>
<%--Changes - Changed original Texts to 'Smart Money $aver ' --%>

<%--Update 1 -  5th Jan 2014 - sms_comments.aspx enabled page to allow admin user to update,delete and select data from Table --%>
<%--Update - 22 Jun 2014 - Add in support for the tag field.  --%>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        function newPopup1(url) {
            popupWindow = window.open(
            url, 'popUpWindow', 'height=450,width=820,left=200,top=20,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
        }

    </script>

    <style>
        .classrd {
        }

        .frm-rght-clr123 RadioButton lable {
        }

        .frm-rght-clr123 label {
            margin-top: -14px;
            display: block;
            margin-bottom: 5px;
        }

        .frm-rght-clr123 RadioButton, input, textarea, .uneditable-input {
            width: 120px;
        }
    </style>

    <%--<asp:UpdatePanel ID="MyUpdatePanel" runat="server">
        <ContentTemplate>--%>


            <div class="hero-unit">
                <script type="text/javascript">
                    //document.getElementById("fl1").onchange = function () {
                    //    document.getElementById("txtfl1").value = this.value;
                    //} event.preventDefault();



                </script>
                <div class="row-fluid">
                    <div id='cssmenu'>
                        <ul>
                            <li class='active'><a href="sms_comments.aspx"><span>Comments</span></a></li>
                            <li><a href="sms_info_about.aspx"><span>Info About</span></a></li>
                            <li><a href="sms_money_data.aspx"><span>Money Data</span></a></li>
                            <li><a href="sms_moneyjunction.aspx"><span>Money Junction</span></a></li>
                            <li><a href="sms_moneytype.aspx"><span>Money Type</span></a></li>
                            <li><a href="sms_tags.aspx"><span>Tags</span></a></li>
                            <li><a href="sms_type.aspx"><span>User Type</span></a></li>
                        </ul>
                    </div>
                    <div style="margin-top: 10px;">
                        <%--<input type="button" value="Add Comments" class="button" style="float: right; width: 116px;" onclick="return window.open('AddComment.aspx', 'mywindow', 'menubar=1,resizable=1,width=650,height=400,top=100,left=400');" />--%>
                    </div>
                </div>
                <hgroup></hgroup>

                <h2 style="color: #999;">Edit Comments Information<asp:Button runat="server" ID="btnAddComments" Text="Add Comments" CssClass="button" Style="float: right; width: 116px;" OnClientClick="JavaScript:newPopup1('AddComment.aspx');" />
                </h2>
                <div class="head-2">
                     
                    <asp:GridView ID="GridView1" runat="server" DataSourceID ="SqlDataSource005" CssClass="Grid" PageSize="8" AutoGenerateColumns="False" DataKeyNames="ID" AllowPaging="True" AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None" OnRowEditing="GridView1_RowEditing" OnRowDeleting="GridView1_RowDeleting" Width="100%" OnPageIndexChanging="GridView1_PageIndexChanging">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <itemstyle width="5%" />
                                    <asp:ImageButton ID="imgdelete" runat="server" CommandName="Delete" ToolTip="Delete" CausesValidation="false" Width="25" ImageUrl="~/img/Delete.png" OnClientClick="return confirm('Do you want to Delete this Recored')" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <itemstyle width="5%" />
                                    <asp:ImageButton ID="imgEdit" runat="server" CommandName="Edit" ToolTip="Edit" CausesValidation="false" Width="25" ImageUrl="~/img/1leftarrow.png" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Author">
                                <ItemStyle Width="10%" />
                                <ItemTemplate>

                                    <%# DataBinder.Eval(Container.DataItem, "Author")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Comment">
                                <ItemStyle Width="20%" />
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "Comment")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Title">
                                <ItemStyle Width="15%" />
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "Title")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Money Data">
                                <ItemStyle Width="15%" />
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "sms_moneydata_fkId")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Rating">
                                <ItemStyle Width="15%" />
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "rating")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="User Name">
                                <ItemStyle Width="15%" />
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "sms_username_fkid")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField Visible="false">
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "ID")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField></asp:TemplateField>
                        </Columns>



                        <EditRowStyle BackColor="#FFFF99" />

                        <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle HorizontalAlign="Left" />
                        <RowStyle BackColor="#EFF3FB" />

                        <SelectedRowStyle Font-Bold="True" ForeColor="#FFFF99" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </div>
                <asp:SqlDataSource ID="SqlDataSource005" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString006 %>" ProviderName="<%$ ConnectionStrings:ConnectionString006.ProviderName %>" SelectCommand="SELECT sms_comments.ID,sms_comments.Author, sms_comments.Comment, sms_comments.Title, sms_comments.rating, sms_moneydata.Company_Name AS sms_moneydata_fkId, sms_register.username AS sms_username_fkid,sms_comments.tag FROM   ((sms_comments INNER JOIN sms_moneydata ON sms_comments.sms_moneydata_fkId = sms_moneydata.ID) INNER JOIN sms_register ON sms_comments.sms_username_fkid = sms_register.ID) ORDER BY sms_comments.ID DESC" OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues" InsertCommand="INSERT INTO [sms_info] ([ID], [about_website], [contact_website], [about_image1], [about_image2], [about_image3], [about_image4], [about_image5], [about_image6]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" DeleteCommand="DELETE FROM [sms_info] WHERE [ID] = ? AND (([about_website] = ?) OR ([about_website] IS NULL AND ? IS NULL)) AND (([contact_website] = ?) OR ([contact_website] IS NULL AND ? IS NULL)) AND (([about_image1] = ?) OR ([about_image1] IS NULL AND ? IS NULL)) AND (([about_image2] = ?) OR ([about_image2] IS NULL AND ? IS NULL)) AND (([about_image3] = ?) OR ([about_image3] IS NULL AND ? IS NULL)) AND (([about_image4] = ?) OR ([about_image4] IS NULL AND ? IS NULL)) AND (([about_image5] = ?) OR ([about_image5] IS NULL AND ? IS NULL)) AND (([about_image6] = ?) OR ([about_image6] IS NULL AND ? IS NULL))" UpdateCommand="UPDATE [sms_info] SET [about_website] = ?, [contact_website] = ?, [about_image1] = ?, [about_image2] = ?, [about_image3] = ?, [about_image4] = ?, [about_image5] = ?, [about_image6] = ? WHERE [ID] = ? AND (([about_website] = ?) OR ([about_website] IS NULL AND ? IS NULL)) AND (([contact_website] = ?) OR ([contact_website] IS NULL AND ? IS NULL)) AND (([about_image1] = ?) OR ([about_image1] IS NULL AND ? IS NULL)) AND (([about_image2] = ?) OR ([about_image2] IS NULL AND ? IS NULL)) AND (([about_image3] = ?) OR ([about_image3] IS NULL AND ? IS NULL)) AND (([about_image4] = ?) OR ([about_image4] IS NULL AND ? IS NULL)) AND (([about_image5] = ?) OR ([about_image5] IS NULL AND ? IS NULL)) AND (([about_image6] = ?) OR ([about_image6] IS NULL AND ? IS NULL))">
                    <DeleteParameters>
                        <asp:Parameter Name="original_ID" Type="Int32" />
                        <asp:Parameter Name="original_about_website" Type="String" />
                        <asp:Parameter Name="original_about_website" Type="String" />
                        <asp:Parameter Name="original_contact_website" Type="String" />
                        <asp:Parameter Name="original_contact_website" Type="String" />
                        <asp:Parameter Name="original_about_image1" Type="String" />
                        <asp:Parameter Name="original_about_image1" Type="String" />
                        <asp:Parameter Name="original_about_image2" Type="String" />
                        <asp:Parameter Name="original_about_image2" Type="String" />
                        <asp:Parameter Name="original_about_image3" Type="String" />
                        <asp:Parameter Name="original_about_image3" Type="String" />
                        <asp:Parameter Name="original_about_image4" Type="String" />
                        <asp:Parameter Name="original_about_image4" Type="String" />
                        <asp:Parameter Name="original_about_image5" Type="String" />
                        <asp:Parameter Name="original_about_image5" Type="String" />
                        <asp:Parameter Name="original_about_image6" Type="String" />
                        <asp:Parameter Name="original_about_image6" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="ID" Type="Int32" />
                        <asp:Parameter Name="about_website" Type="String" />
                        <asp:Parameter Name="contact_website" Type="String" />
                        <asp:Parameter Name="about_image1" Type="String" />
                        <asp:Parameter Name="about_image2" Type="String" />
                        <asp:Parameter Name="about_image3" Type="String" />
                        <asp:Parameter Name="about_image4" Type="String" />
                        <asp:Parameter Name="about_image5" Type="String" />
                        <asp:Parameter Name="about_image6" Type="String" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="about_website" Type="String" />
                        <asp:Parameter Name="contact_website" Type="String" />
                        <asp:Parameter Name="about_image1" Type="String" />
                        <asp:Parameter Name="about_image2" Type="String" />
                        <asp:Parameter Name="about_image3" Type="String" />
                        <asp:Parameter Name="about_image4" Type="String" />
                        <asp:Parameter Name="about_image5" Type="String" />
                        <asp:Parameter Name="about_image6" Type="String" />
                        <asp:Parameter Name="original_ID" Type="Int32" />
                        <asp:Parameter Name="original_about_website" Type="String" />
                        <asp:Parameter Name="original_about_website" Type="String" />
                        <asp:Parameter Name="original_contact_website" Type="String" />
                        <asp:Parameter Name="original_contact_website" Type="String" />
                        <asp:Parameter Name="original_about_image1" Type="String" />
                        <asp:Parameter Name="original_about_image1" Type="String" />
                        <asp:Parameter Name="original_about_image2" Type="String" />
                        <asp:Parameter Name="original_about_image2" Type="String" />
                        <asp:Parameter Name="original_about_image3" Type="String" />
                        <asp:Parameter Name="original_about_image3" Type="String" />
                        <asp:Parameter Name="original_about_image4" Type="String" />
                        <asp:Parameter Name="original_about_image4" Type="String" />
                        <asp:Parameter Name="original_about_image5" Type="String" />
                        <asp:Parameter Name="original_about_image5" Type="String" />
                        <asp:Parameter Name="original_about_image6" Type="String" />
                        <asp:Parameter Name="original_about_image6" Type="String" />
                    </UpdateParameters>

                </asp:SqlDataSource>


                <br />
                <br />
                <div class="row-fluid">

                    <table class="table">
                        <tr>
                            <th colspan="4" class="td-head">
                                <span class="spanhead">Edit Comments Record<asp:Button ID="Button3" runat="server" Text="Edit" CssClass="button" Style="width: 70px; margin-left: 50px;" OnClick="Button3_Click" />&nbsp;<asp:Button ID="btncancel" runat="server" Text="Cancel" Width="80" CssClass="button" OnClick="btncancel_Click" />&nbsp;<asp:Button ID="Button2" runat="server" Height="36px" Width="156px" Text="Return to Main Menu" PostBackUrl="~/Account/Admininput.aspx" CssClass="button" /></span></th>
                        </tr>
                        <tr>
                            <td class="frm-lft-clr123" width="20%">
                                <asp:Label ID="Label1" runat="server" Text="Author"></asp:Label></td>
                            <td class="frm-rght-clr123" width="30%">
                                <asp:TextBox ID="txt_author" runat="server" CssClass="textbox" Width="200"></asp:TextBox></td>
                            <td class="frm-lft-clr123" width="20%">
                                <asp:Label ID="Label2" runat="server" Text="Comment"></asp:Label></td>
                            <td class="frm-rght-clr123" width="30%">
                                <asp:TextBox ID="txt_comment" runat="server" CssClass="textarea" TextMode="MultiLine" Rows="3" Width="200"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td class="frm-lft-clr123">
                                <asp:Label ID="Label3" runat="server" Text="Title"></asp:Label></td>
                            <td class="frm-rght-clr123">
                                <asp:TextBox ID="txt_title" CssClass="textbox" runat="server" Width="200"></asp:TextBox></td>
                            <td class="frm-lft-clr123">
                                <asp:Label ID="Label4" runat="server" Text="Money Data"></asp:Label></td>
                            <td class="frm-rght-clr123">
                                <asp:DropDownList ID="ddl_moneydata" runat="server" DataSourceID="SqlDataSource007" DataTextField="Company_Name" DataValueField="ID" Width="200px">
                                </asp:DropDownList>
                                <asp:SqlDataSource ID="SqlDataSource007" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString07 %>" ProviderName="<%$ ConnectionStrings:ConnectionString07.ProviderName %>" SelectCommand="SELECT [Company_Name], [ID] FROM [sms_moneydata]"></asp:SqlDataSource>
                            </td>
                        </tr>
                        <tr>
                            <td class="frm-lft-clr123">
                                <asp:Label ID="Label5" runat="server" Text="Rating"></asp:Label></td>

                            <td class="frm-rght-clr123" style="border: 0px none none; padding: 10px; margin: 0px">
                                <asp:RadioButton ID="RadioButton1" Checked="true" runat="server" CssClass="classrd" GroupName="Star" Text="Star1" Style="border: 0px none none; padding: 0px; margin: 0px; float: left" />
                                <asp:RadioButton ID="RadioButton2" runat="server" CssClass="classrd" GroupName="Star" Text="Star2" Style="border: 0px none none; padding: 0px; margin: 0px;" />
                                <asp:RadioButton ID="RadioButton3" runat="server" CssClass="classrd" GroupName="Star" Text="Star3" Style="border: 0px none none; padding: 0px; margin: 0px; float: left" />
                                <asp:RadioButton ID="RadioButton4" runat="server" CssClass="classrd" GroupName="Star" Text="Star4" Style="border: 0px none none; padding: 0px; margin: 0px;" />
                                <asp:RadioButton ID="RadioButton5" runat="server" CssClass="classrd" GroupName="Star" Text="Star5" Style="border: 0px none none; padding: 0px; margin: 0px" />
                            </td>

                            <td class="frm-lft-clr123">Tag Name</td>
                               
                            <td class="frm-rght-clr123">
                                
                                <asp:DropDownList ID="ddl_tagname" runat="server" DataSourceID="SqlDataSource1" DataTextField="Tag" DataValueField="ID" Width="200px">
                                </asp:DropDownList>
                                
                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString09 %>" ProviderName="<%$ ConnectionStrings:ConnectionString09.ProviderName %>" SelectCommand="SELECT [ID], [Tag] FROM [sms_tags]"></asp:SqlDataSource>
                                
                            </td>
                        </tr>

                        <asp:HiddenField ID="hdn_id" runat="server" />
                    </table>
                </div>
            </div>
        <%--</ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="Button3" />
            <asp:PostBackTrigger ControlID="GridView1" />
        </Triggers>
    </asp:UpdatePanel>--%>
</asp:Content>
